<template>
    <div class="root">
       <p>Notebook剩余使用时间</p>
       <p id="timer"></p>
    </div>
</template>

<script>
import { mapActions } from 'vuex';
import { leftTime } from '@/utils/format';
export default {
    data() {
        return {
            taskId:Number(this.$route.query.task_id),
        }
    },
    methods: {
        ...mapActions(['XrenewalFeeInfo'])
    },
    mounted() {
        this.XrenewalFeeInfo(this.taskId).then(({data}) => {
            leftTime(...data.aliveTime)
        })
    },
    beforeDestroy() {
        clearInterval(leftTime)
    },
}
</script>

<style lang="scss" scoped>
    .root{
        position: fixed;
        right:20px;
        bottom:20px;
        width:200px;
        height: 50px;
        background-color: #F36539;
        opacity:0.8;
        color: #fff;
        border-radius:6px;
        line-height: 50px;
        text-align: center;

        p{
            height: 25px;
            line-height: 25px;
        }
    }
</style>